package com.cenntro.auth.common;

/**
 * 角色类型枚举
 * 
 * @author Administrator
 *
 */
public enum RoleTypeEnum {

	/**
	 * 系统管理员
	 */
	ADMIN(1, "管理员", "管理员"),
	/**
	 * 代理商
	 */
	AGENT_ADMIN(2, "客户", "客户"),
	/**
	 * 客户机构
	 */
	GENERAL(3, "普通帐号", "普通帐号"),
	/**
	 * 授权合作客户帐号
	 */
	AUTH_MANAGER(4, "授权管理车辆", "授权管理车辆"),
    /**
     * app 请求
     */
    APP_ACCESS(5, "app等访问", "app等访问");

	/**
	 * 类型名称
	 */
	private String name;
	/**
	 * 类型
	 */
	private Integer type;
	/**
	 * 描述
	 */
	private String desc;

	private RoleTypeEnum(Integer type, String name, String desc) {
		this.name = name;
		this.type = type;
		this.desc = desc;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getType() {
		return type;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public static RoleTypeEnum getByType(Integer type) {
		switch (type) {
			case 1:
				return RoleTypeEnum.ADMIN;
			case 2:
				return RoleTypeEnum.AGENT_ADMIN;
			case 3:
				return RoleTypeEnum.GENERAL;
			case 4:
				return RoleTypeEnum.AUTH_MANAGER;
			case 5:
			    return RoleTypeEnum.APP_ACCESS;
		}
		return RoleTypeEnum.GENERAL;
	}

}
